//
//  ChongzhiViewController.m
//  werfgh
//
//  Created by 李晓勇 on 14-9-19.
//  Copyright (c) 2014年 dingshenwangluokeji. All rights reserved.
//

#import "ChongzhiViewController.h"
#import "ToppingUPViewController.h"
#import "Header.h"
@interface ChongzhiViewController ()
{
    UILabel *label2;
    UILabel *label1;
    NSArray*arry;
    NSArray*arry1;
}
@end

@implementation ChongzhiViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        arry=@[@"yidong",@"liantong",@"dianxin"];
        arry1=@[@"中国移动",@"中国联通",@"中国电信"];
    }
    return self;
}

- (void)viewDidLoad
{
     self.view.backgroundColor=[UIColor colorWithRed:246.0/255 green:247.0/255 blue:248.0/255 alpha:1] ;
    [super viewDidLoad];
    if (IOS7) {
        self.edgesForExtendedLayout=NO;
    }
    //self.view.backgroundColor=[UIColor redColor];
    self.title=@"充值中心";
    label1=[[UILabel alloc]initWithFrame:CGRectMake(10, 10, 300, 30)];
    label2=[[UILabel alloc]initWithFrame:CGRectMake(10, 35, 300, 30)];
    label1.text=[NSString stringWithFormat:@"手机号 : %@",self.str1 ];
    label2.text=[NSString stringWithFormat:@"套  餐 : %@",self.str];
    label2.font=[UIFont systemFontOfSize:19];
    label1.font=[UIFont systemFontOfSize:19];
    [self.view addSubview:label1 ];
    [self.view addSubview:label2 ];
    
    UILabel*label3=[[UILabel alloc]initWithFrame:CGRectMake(10, 75, 310, 30)];
    label3.text=@"请选择充值方式:";
    label3.textColor=[UIColor grayColor];
    [self.view addSubview:label3 ];
    
    for (int i=0; i<arry.count; i++) {
        
    UIView*view=[[UIView alloc]initWithFrame:CGRectMake(10, 110+60*i,300 , 60)];
    view.backgroundColor=[UIColor colorWithWhite:0.98 alpha:1];
    [self.view addSubview:view];
        view.tag=10+i;
    
    UIImageView*imageV=[[UIImageView alloc]initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@.png",arry[i]]]];
    imageV.frame=CGRectMake(5, 0, 70, view.frame.size.height);
    [view addSubview:imageV];
    
    UILabel*lable=[[UILabel alloc]initWithFrame:CGRectMake(90, 0, 100, view.frame.size.height)];
        lable.text=[NSString stringWithFormat:@"%@",arry1[i]];
    [view addSubview:lable];
        
        UIImageView*imageV1=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"jiantou.png"]];
        imageV1.frame=CGRectMake(240, 17, 25, 25);
        [view addSubview:imageV1];
        
        UIImageView*imageV2=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"gexian.png"]];
        imageV2.frame=CGRectMake(0, 0, 300, 1);
        [view addSubview:imageV2];
        UITapGestureRecognizer*gesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tap:)];
        [view addGestureRecognizer:gesture];
    }
    UIImageView*imageV2=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"gexian.png"]];
    imageV2.frame=CGRectMake(10, 290, 300, 1);
    [self.view addSubview:imageV2];


    // Do any additional setup after loading the view.
}
-(void)tap:(UITapGestureRecognizer*)sender
{
    ToppingUPViewController*topup=[[ToppingUPViewController alloc]init];
    [self.navigationController pushViewController:topup animated:YES];
    topup.str=self.str;
    topup.str1=self.str1;
    topup.str2=arry1[sender.view.tag-10];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
